/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.server.modules.sys.entity.member;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.server.common.persistence.DataEntity;
import com.server.common.utils.StringUtils;
import com.server.modules.sys.utils.date.DateUtil;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 普通用户信息Entity
 * @author 颜洪毅
 * @version 2016-10-11
 */
public class Member extends DataEntity<Member> {
	
	private static final long serialVersionUID = 1L;
	protected String username;		// 用户名
	protected String password;		// 登录密码
	protected String hxUsername;		// 环信用户名
	protected String hxPassword;		// 环信登录密码
	protected String nickname;		// 昵称
	protected String realname;		// 真实姓名
	protected String sex;		// 性别
	protected String birthday;		// 出生日期
	protected String nation;		// 民族
	protected Integer maritalStatus;		// 婚姻状况
	protected String idCard;		// 身份证号码
	protected String nativeProvince;		// 籍贯（省/直辖市）
	protected String nativeCity;		// 籍贯（市/区）
	protected String nativeCounty;		// 籍贯（县/乡）
	protected String nativeDetail;		// 籍贯（详细地址）
	protected String residentProvince;		// 居住地（省/直辖市）
	protected String residentCity;		// 居住地（市/区）
	protected String residentCounty;		// 居住地（县/乡）
	protected String residentDetail;		// 居住地（详细地址）
	protected String telephone;		// 手机号码
	protected String email;		// 邮箱地址
	protected String qq;		// QQ号码
	protected String wx;		// 微信
	protected String deviceType;		// 设备类型
	protected String deviceId;		// 设备号
	protected String version;		// 软件版本
	protected String state;		// 用户状态
	protected Date loginTime;		// 登录时间
	protected String loginIp;		// 登录IP
	protected String sessionId;		// SessionID
	protected String note;		// 个人说明
	protected String face;		// 头像地址
	protected String company;		// 工作单位
	protected String companyType;		// 单位性质
	protected String job;		// 职务
	protected String entryTime;		// 入职时间

	protected String monthIncome;		// 月收入
	protected String accessToken;		// 第三方登录凭证
	protected String openId;		// QQ认证标识
	protected String unionId;		// 微信认证标识
	protected Integer isManager;		// 是否是经理
	protected String createIp;		// 创建的IP
	protected String updateIp;		// 修改的IP
	protected String balance;		// 账户余额

	protected String sysUserId;
	protected String companyTel;		// 单位电话
	protected String companyAddress;		// 单位地址


	protected String birthdayStr;		// 出生日期

	protected String entryTimeStr;		// 入职时间

	protected String managerId;		// 客户经理id
	protected String managerName;		// 客户经理name

	protected String usernameFake;		// 隐藏中间四位

	protected String loanId;		//

	protected String memberloan;		//个人符合产品资料比值


	protected String memberNames; //客户名字

	protected String LoanName; //产品名称
	public String getMemberNames() {
		return memberNames;
	}

	public void setMemberNames(String memberNames) {
		this.memberNames = memberNames;
	}

	public String getLoanName() {
		return LoanName;
	}

	public void setLoanName(String loanName) {
		LoanName = loanName;
	}



	public String getMemberloan() {
		return memberloan;
	}

	public void setMemberloan(String memberloan) {
		this.memberloan = memberloan;
	}

	protected String day;//参数，区分近三天 一周 一个月注册的用户  1 三天  2一周 3一个月

	public String getLoanId() {
		return loanId;
	}

	public void setLoanId(String loanId) {
		this.loanId = loanId;
	}

	public String getDay() {
		return day;
	}

	public void setDay(String day) {
		this.day = day;
	}

	public String getUsernameFake() {
		if(StringUtils.isNotBlank(username)){
			return username.replaceAll("(\\d{3})\\d{4}(\\d{4})","$1****$2");
		}
		return usernameFake;
	}

	public void setUsernameFake(String usernameFake) {

		this.usernameFake = usernameFake;
	}

	public String getCompanyTel() {
		return companyTel;
	}

	public void setCompanyTel(String companyTel) {
		this.companyTel = companyTel;
	}

	public String getCompanyAddress() {
		return companyAddress;
	}

	public void setCompanyAddress(String companyAddress) {
		this.companyAddress = companyAddress;
	}

	public String getManagerName() {
		return managerName;
	}

	public void setManagerName(String managerName) {
		this.managerName = managerName;
	}

	public String getManagerId() {
		return managerId;
	}

	public void setManagerId(String managerId) {
		this.managerId = managerId;
	}

	public String getEntryTimeStr() {
		if(StringUtils.isNotBlank(entryTime)){
			try {
				Date date=new Date();
				date.setTime(Long.parseLong(entryTime) );
				return DateUtil.DateToString(date,"yyyy-MM-dd");
			}catch (Exception e){
				return entryTime;
			}

		}
		return entryTime;
	}

	public void setEntryTimeStr(String entryTimeStr) {
		this.entryTimeStr = entryTimeStr;
	}

	public String getBirthdayStr() {
		if(StringUtils.isNotBlank(birthday)){
			try {
				Date date=new Date();
				date.setTime(Long.parseLong(birthday) );
				return DateUtil.DateToString(date,"yyyy-MM-dd");
			}catch (Exception e){
				return birthday;
			}

		}
		return birthday;
	}

	public void setBirthdayStr(String birthdayStr) {

		this.birthdayStr = birthdayStr;
	}

	public String getSysUserId() {
		return sysUserId;
	}

	public void setSysUserId(String sysUserId) {
		this.sysUserId = sysUserId;
	}

	public Member() {
		super();
	}

	public Member(String id){
		super(id);
	}

	@Length(min=1, max=50, message="用户名长度必须介于 1 和 50 之间")
	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}
	

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
	

	public String getHxUsername() {
		return hxUsername;
	}

	public void setHxUsername(String hxUsername) {
		this.hxUsername = hxUsername;
	}
	

	public String getHxPassword() {
		return hxPassword;
	}

	public void setHxPassword(String hxPassword) {
		this.hxPassword = hxPassword;
	}
	
	@Length(min=0, max=50, message="昵称长度必须介于 0 和 50 之间")
	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}
	
	@Length(min=0, max=50, message="真实姓名长度必须介于 0 和 50 之间")
	public String getRealname() {
		return realname;
	}

	public void setRealname(String realname) {
		this.realname = realname;
	}
	
	@Length(min=0, max=10, message="性别长度必须介于 0 和 10 之间")
	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	@Length(min=0, max=50, message="民族长度必须介于 0 和 50 之间")
	public String getNation() {
		return nation;
	}

	public void setNation(String nation) {
		this.nation = nation;
	}
	
	public Integer getMaritalStatus() {
		return maritalStatus;
	}

	public void setMaritalStatus(Integer maritalStatus) {
		this.maritalStatus = maritalStatus;
	}
	
	@Length(min=0, max=18, message="身份证号码长度必须介于 0 和 18 之间")
	public String getIdCard() {
		return idCard;
	}

	public void setIdCard(String idCard) {
		this.idCard = idCard;
	}
	
	@Length(min=0, max=255, message="籍贯（省/直辖市）长度必须介于 0 和 255 之间")
	public String getNativeProvince() {
		return nativeProvince;
	}

	public void setNativeProvince(String nativeProvince) {
		this.nativeProvince = nativeProvince;
	}
	
	@Length(min=0, max=255, message="籍贯（市/区）长度必须介于 0 和 255 之间")
	public String getNativeCity() {
		return nativeCity;
	}

	public void setNativeCity(String nativeCity) {
		this.nativeCity = nativeCity;
	}
	
	@Length(min=0, max=255, message="籍贯（县/乡）长度必须介于 0 和 255 之间")
	public String getNativeCounty() {
		return nativeCounty;
	}

	public void setNativeCounty(String nativeCounty) {
		this.nativeCounty = nativeCounty;
	}
	
	@Length(min=0, max=255, message="籍贯（详细地址）长度必须介于 0 和 255 之间")
	public String getNativeDetail() {
		return nativeDetail;
	}

	public void setNativeDetail(String nativeDetail) {
		this.nativeDetail = nativeDetail;
	}
	
	@Length(min=0, max=255, message="居住地（省/直辖市）长度必须介于 0 和 255 之间")
	public String getResidentProvince() {
		return residentProvince;
	}

	public void setResidentProvince(String residentProvince) {
		this.residentProvince = residentProvince;
	}
	
	@Length(min=0, max=255, message="居住地（市/区）长度必须介于 0 和 255 之间")
	public String getResidentCity() {
		return residentCity;
	}

	public void setResidentCity(String residentCity) {
		this.residentCity = residentCity;
	}
	
	@Length(min=0, max=255, message="居住地（县/乡）长度必须介于 0 和 255 之间")
	public String getResidentCounty() {
		return residentCounty;
	}

	public void setResidentCounty(String residentCounty) {
		this.residentCounty = residentCounty;
	}
	
	@Length(min=0, max=255, message="居住地（详细地址）长度必须介于 0 和 255 之间")
	public String getResidentDetail() {
		return residentDetail;
	}

	public void setResidentDetail(String residentDetail) {
		this.residentDetail = residentDetail;
	}
	
	@Length(min=0, max=12, message="手机号码长度必须介于 0 和 12 之间")
	public String getTelephone() {
		return telephone;
	}

	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}
	
	@Length(min=0, max=50, message="邮箱地址长度必须介于 0 和 50 之间")
	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}
	
	@Length(min=0, max=16, message="QQ号码长度必须介于 0 和 16 之间")
	public String getQq() {
		return qq;
	}

	public void setQq(String qq) {
		this.qq = qq;
	}
	
	@Length(min=0, max=50, message="微信长度必须介于 0 和 50 之间")
	public String getWx() {
		return wx;
	}

	public void setWx(String wx) {
		this.wx = wx;
	}
	
	@Length(min=0, max=50, message="设备类型长度必须介于 0 和 50 之间")
	public String getDeviceType() {
		return deviceType;
	}

	public void setDeviceType(String deviceType) {
		this.deviceType = deviceType;
	}
	
	@Length(min=0, max=255, message="设备号长度必须介于 0 和 255 之间")
	public String getDeviceId() {
		return deviceId;
	}

	public void setDeviceId(String deviceId) {
		this.deviceId = deviceId;
	}
	
	@Length(min=0, max=50, message="软件版本长度必须介于 0 和 50 之间")
	public String getVersion() {
		return version;
	}

	public void setVersion(String version) {
		this.version = version;
	}
	
	@Length(min=0, max=50, message="用户状态长度必须介于 0 和 50 之间")
	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getLoginTime() {
		return loginTime;
	}

	public void setLoginTime(Date loginTime) {
		this.loginTime = loginTime;
	}
	
	@Length(min=0, max=50, message="登录IP长度必须介于 0 和 50 之间")
	public String getLoginIp() {
		return loginIp;
	}

	public void setLoginIp(String loginIp) {
		this.loginIp = loginIp;
	}
	
	@Length(min=0, max=255, message="SessionID长度必须介于 0 和 255 之间")
	public String getSessionId() {
		return sessionId;
	}

	public void setSessionId(String sessionId) {
		this.sessionId = sessionId;
	}
	
	@Length(min=0, max=255, message="个人说明长度必须介于 0 和 255 之间")
	public String getNote() {
		return note;
	}

	public void setNote(String note) {
		this.note = note;
	}
	
	@Length(min=0, max=255, message="头像地址长度必须介于 0 和 255 之间")
	public String getFace() {
		return face;
	}

	public void setFace(String face) {
		this.face = face;
	}
	
	@Length(min=0, max=255, message="工作单位长度必须介于 0 和 255 之间")
	public String getCompany() {
		return company;
	}

	public void setCompany(String company) {
		this.company = company;
	}
	
	@Length(min=0, max=255, message="单位性质长度必须介于 0 和 255 之间")
	public String getCompanyType() {
		return companyType;
	}

	public void setCompanyType(String companyType) {
		this.companyType = companyType;
	}
	
	@Length(min=0, max=255, message="职务长度必须介于 0 和 255 之间")
	public String getJob() {
		return job;
	}

	public void setJob(String job) {
		this.job = job;
	}

	
	@Length(min=0, max=255, message="月收入长度必须介于 0 和 255 之间")
	public String getMonthIncome() {
		return monthIncome;
	}

	public void setMonthIncome(String monthIncome) {
		this.monthIncome = monthIncome;
	}
	
	@Length(min=0, max=255, message="第三方登录凭证长度必须介于 0 和 255 之间")
	public String getAccessToken() {
		return accessToken;
	}

	public void setAccessToken(String accessToken) {
		this.accessToken = accessToken;
	}
	
	@Length(min=0, max=255, message="QQ认证标识长度必须介于 0 和 255 之间")
	public String getOpenId() {
		return openId;
	}

	public void setOpenId(String openId) {
		this.openId = openId;
	}
	
	@Length(min=0, max=255, message="微信认证标识长度必须介于 0 和 255 之间")
	public String getUnionId() {
		return unionId;
	}

	public void setUnionId(String unionId) {
		this.unionId = unionId;
	}
	
	@NotNull(message="是否是经理不能为空")
	public Integer getIsManager() {
		return isManager;
	}

	public void setIsManager(Integer isManager) {
		this.isManager = isManager;
	}
	
	@Length(min=1, max=50, message="创建的IP长度必须介于 1 和 50 之间")
	public String getCreateIp() {
		return createIp;
	}

	public void setCreateIp(String createIp) {
		this.createIp = createIp;
	}
	
	@Length(min=0, max=50, message="修改的IP长度必须介于 0 和 50 之间")
	public String getUpdateIp() {
		return updateIp;
	}

	public void setUpdateIp(String updateIp) {
		this.updateIp = updateIp;
	}
	
	public String getBalance() {
		return balance;
	}

	public void setBalance(String balance) {
		this.balance = balance;
	}

	public String getEntryTime() {
		return entryTime;
	}

	public void setEntryTime(String entryTime) {
		this.entryTime = entryTime;
	}

	public String getBirthday() {
		return birthday;
	}

	public void setBirthday(String birthday) {
		this.birthday = birthday;
	}
}